package com.seckill.redis;

import com.seckill.util.SpringBeanUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * @author yangjunwei
 * @date 2022/5/10 8:03 下午
 */
@Slf4j
public class CacheDeleteTask implements Runnable {

    RedisService redisService = SpringBeanUtil.getBean(RedisService.class);

    private final KeyPrefix prefix;
    private final String key;

    public CacheDeleteTask(KeyPrefix prefix, String key) {
        this.prefix = prefix;
        this.key = key;
    }

    @Override
    public void run() {
        log.info("start CacheDeleteTask!");
        redisService.delete(prefix, key);
    }


}
